import http from '@/utils/axios';

// 获取管理员列表
export const getAdminList = (params: any) => {
    return http({
        method: 'get',
        url: '/admin/index',
        params,
    });
};

// 获取用户信息
export const getAdminInfo = (userId: number) => {
    return http({
        method: 'GET',
        url: `/admin/read/${userId}`,
    });
};

// 新增管理员信息
export const saveAdminInfo = (data: any) => {
    return http({
        method: 'POST',
        url: `/admin/save`,
        data,
    });
};

// 更新用户信息
export const updateAdminInfo = (userId: number, data: any) => {
    return http({
        method: 'PUT',
        url: `/admin/update/${userId}`,
        data,
    });
};

// 删除用户
export const deleteAdmin = (userId: number) => {
    return http({
        method: 'DELETE',
        url: `/admin/delete/${userId}`,
    });
};

// 修改密码
export const changePassword = (data: any) => {
    return http({
        method: 'POST',
        url: `/admin/changePassword`,
        data,
    });
};